﻿package  
{
	import fl.motion.easing.Elastic;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import net.yogadigital.popit.core.extended.Dialog;
	import net.yogadigital.popit.core.PopitWindow;
	import net.yogadigital.popit.PopitManager;
	import flash.display.SimpleButton;
	import com.flashdynamix.utils.SWFProfiler;
	/**
	 * ...
	 * @author Juanda
	 */
	public class Test extends Sprite
	{
		private var popit:PopitWindow;
		
		public function Test()
		{
			SWFProfiler.init(this);
			btnNew.addEventListener(MouseEvent.CLICK, onNew, false, 0, true);
			btnMove.addEventListener(MouseEvent.CLICK, onMove, false, 0, true);
			btnHard.addEventListener(MouseEvent.CLICK, onHard, false, 0, true);
			btnCenter.addEventListener(MouseEvent.CLICK, onCenter, false, 0, true);
			btnSimpleMove.addEventListener(MouseEvent.CLICK, onSimpleMove, false, 0, true);
			btnDeem.addEventListener(MouseEvent.CLICK, onDeem, false, 0, true);
		}
		
		private function onDeem(e:MouseEvent):void 
		{
			popit.deemTheBackground();
		}
		
		private function onSimpleMove(e:MouseEvent):void 
		{
			popit.simpleMoveTo(new Point(Math.random() * 300, Math.random() * 200));
		}
		
		private function onNew(e:MouseEvent):void 
		{
			popit = new PopitWindow("Testing", this, "assets/Content2.swf");
			popit.showCentered();
		}
		
		private function onMove(e:MouseEvent):void 
		{
			popit.moveTo(new Point(Math.random() * 300, Math.random() * 200), 2, Elastic.easeOut);
		}
		
		private function onHard(e:MouseEvent):void 
		{
			popit.spawn(new Point(Math.random() * 300, Math.random() * 200));
		}
		
		private function onCenter(e:MouseEvent):void 
		{
			popit.center();
		}
	}
}